home *** CD-ROM | disk | FTP | other *** search
- head 1.5;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @ * @;
-
-
- 1.5
- date 91.03.29.18.06.32; author shirriff; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 89.07.14.09.15.22; author rab; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.09.30.08.23.24; author brent; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.06.29.14.47.58; author ouster; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.06.21.16.12.51; author ouster; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.5
- log
- @Added fcntl options used by sunOS.
- @
- text
- @/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
- *
- * @@(#)file.h 7.1 (Berkeley) 6/4/86
- */
-
- #ifndef _FILE
- #define _FILE
-
- /*
- * flags- also for fcntl call.
- */
- #define FOPEN (-1)
- #define FREAD 00001 /* descriptor read/receive'able */
- #define FWRITE 00002 /* descriptor write/send'able */
- #ifndef F_DUPFD
- #define FNDELAY 00004 /* no delay */
- #define FAPPEND 00010 /* append on each write */
- #endif
- #define FMARK 00020 /* mark during gc() */
- #define FDEFER 00040 /* defer for next gc pass */
- #ifndef F_DUPFD
- #define FASYNC 00100 /* signal pgrp when data ready */
- #endif
- #define FSHLOCK 00200 /* shared lock present */
- #define FEXLOCK 00400 /* exclusive lock present */
-
- /* bits to save after open */
- #define FMASK 00113
- #define FCNTLCANT (FREAD|FWRITE|FMARK|FDEFER|FSHLOCK|FEXLOCK)
-
- /* open only modes */
- #define FCREAT 01000 /* create if nonexistant */
- #define FTRUNC 02000 /* truncate to zero length */
- #define FEXCL 04000 /* error if already created */
-
- #ifndef F_DUPFD
- /* fcntl(2) requests--from <fcntl.h> */
- #define F_DUPFD 0 /* Duplicate fildes */
- #define F_GETFD 1 /* Get fildes flags */
- #define F_SETFD 2 /* Set fildes flags */
- #define F_GETFL 3 /* Get file flags */
- #define F_SETFL 4 /* Set file flags */
- #define F_GETOWN 5 /* Get owner */
- #define F_SETOWN 6 /* Set owner */
- #define F_GETLK 7 /* Get record-lock info */
- #define F_SETLK 8 /* Set or clear a record-lock */
- #define F_SETLKW 9 /* Set or clear a record-lock (blocking) */
- #define F_RGETLK 10 /* Test if lock blocked */
- #define F_RSETLK 11 /* Set or unlock lock */
- #define F_CNVT 12 /* Convert fhandle to fd */
- #define F_RSETLKW 13 /* Set or clear remote lock (blocking) */
-
- #endif
-
- /*
- * User definitions.
- */
-
- /*
- * Open call.
- */
- #define O_RDONLY 000 /* open for reading */
- #define O_WRONLY 001 /* open for writing */
- #define O_RDWR 002 /* open for read & write */
- #define O_NDELAY FNDELAY /* non-blocking open */
- #define O_APPEND FAPPEND /* append on each write */
- #define O_CREAT FCREAT /* open with file create */
- #define O_TRUNC FTRUNC /* open with truncation */
- #define O_EXCL FEXCL /* error on create if file exists */
- #define O_MASTER 010000 /* open pseudo-device as master */
- #define O_PFS_MASTER 020000 /* open as pseudo-filesystem master */
-
- /*
- * Flock call.
- */
- #define LOCK_SH 1 /* shared lock */
- #define LOCK_EX 2 /* exclusive lock */
- #define LOCK_NB 4 /* don't block when locking */
- #define LOCK_UN 8 /* unlock */
-
- /*
- * Access call.
- */
- #define F_OK 0 /* does file exist */
- #define X_OK 1 /* is it executable by caller */
- #define W_OK 2 /* writable by caller */
- #define R_OK 4 /* readable by caller */
-
- /*
- * Lseek call.
- */
- #define L_SET 0 /* absolute offset */
- #define L_INCR 1 /* relative to current offset */
- #define L_XTND 2 /* relative to end of file */
-
- #endif /* _FILE */
- @
-
-
- 1.4
- log
- @*** empty log message ***
- @
- text
- @d48 8
- @
-
-
- 1.3
- log
- @Added O_PFS_MASTER flag for pseudo-filesytem implementation
- @
- text
- @d91 1
- a91 1
- #endif _FILE
- @
-
-
- 1.2
- log
- @Add ifdefs to prevent files from being included multiple times.
- @
- text
- @d66 1
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d9 2
- a10 19
- #ifdef KERNEL
- /*
- * Descriptor table entry.
- * One for each kernel object.
- */
- struct file {
- int f_flag; /* see below */
- short f_type; /* descriptor type */
- short f_count; /* reference count */
- short f_msgcount; /* references from message queue */
- struct fileops {
- int (*fo_rw)();
- int (*fo_ioctl)();
- int (*fo_select)();
- int (*fo_close)();
- } *f_ops;
- caddr_t f_data; /* inode */
- off_t f_offset;
- };
- a11 6
- struct file *file, *fileNFILE;
- int nfile;
- struct file *getf();
- struct file *falloc();
- #endif
-
- d65 1
- d90 1
- a90 10
- #ifdef KERNEL
- #define GETF(fp, fd) { \
- if ((unsigned)(fd) >= NOFILE || ((fp) = u.u_ofile[fd]) == NULL) { \
- u.u_error = EBADF; \
- return; \
- } \
- }
- #define DTYPE_INODE 1 /* file */
- #define DTYPE_SOCKET 2 /* communications endpoint */
- #endif
- @
-